package stz.flash.main.strobe.field;

import net.rim.device.api.system.Application;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import blackberry.util.field.DjChangeableBitmapField;

public class BitmapFieldForStrobeMode extends DjChangeableBitmapField {

	private static boolean focusable = true;
	private static Field lastFocusField;

	public BitmapFieldForStrobeMode(Bitmap[] bitmapArray, long style) {
		super(bitmapArray, style);
	}
	
	public boolean isFocusable() {
		return focusable;
	}
	
	public static void setFocusable(boolean focusable) {
		BitmapFieldForStrobeMode.focusable = focusable;
		if (focusable && lastFocusField != null)
			synchronized (Application.getEventLock()) {
				lastFocusField.setFocus();
		}
	}
	
	protected void onFocus(int i) {
		super.onFocus(i);
		lastFocusField = this;
	}
	
	protected void initFocusField(Field field) {
		lastFocusField = field;
	}
}
